//
//  MenuSelectView.m
//  BeautifulLockerRoom
//
//  Created by mac on 16/7/30.
//  Copyright © 2016年 Winny. All rights reserved.
//

#import "MenuSelectView.h"

@implementation MenuSelectView

-(instancetype)initWithArray:(NSArray *)buttonArray
{
    self = [super init];
    if (self) {
        if (buttonArray.count % 4 == 0)
        {
            self = [[MenuSelectView alloc]initWithFrame:CGRectMake(0, 0, WINDOWWIDTH, buttonArray.count/4 * 60)];
        }
        else
        {
            self = [[MenuSelectView alloc]initWithFrame:CGRectMake(0, 0, WINDOWWIDTH, (buttonArray.count/4 + 1) * 60 )];
        }
        for (int i = 0; i < buttonArray .count; i++)
        {
            UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
            button.frame = CGRectMake(20, 20, 60, 35);
            button.backgroundColor = [UIColor blueColor];
            [button setTitle:@"按钮" forState:UIControlStateNormal];
            [button addTarget:self action:@selector(buttonClick:) forControlEvents:UIControlEventTouchUpInside];
            [self addSubview:button];
        }
        
    }
    return self;
}

-(void)buttonClick:(id)sender
{
    
}
@end
